﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

namespace BaoJian.vip
{
    public partial class intro : System.Web.UI.Page
    {
        private string vipid = null;
        public LYQ.Model.VIPPartner model;
        protected void Page_Load(object sender, EventArgs e)
        {
            vipid = HttpContext.Current.Request.QueryString["vid"];
            if (vipid == null)
            {
                return;
            }
            if (!Page.IsPostBack)
            {
                ShowData();
                BindReleatedLink();
                BindProduct();
              
            }
        }

        private void ShowData()
        {
            LYQ.BLL.VIPPartner bll = new LYQ.BLL.VIPPartner();
            model = bll.GetModel(vipid);
            
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            if (model.Tel != null && model.Tel != "")
            {
                sb.Append("<li>电话:" + model.Tel + "</li>");
            }
            if (model.QQ != null && model.QQ != "")
            {
                sb.Append("<li>QQ:" + model.QQ + "</li>");
            }
            if (model.Mobile != null && model.Mobile != "")
            {
                sb.Append("<li>手机:" + model.Mobile + "</li>");
            }

            if (model.Address != null && model.Address != "")
            {
                sb.Append("<li>地址:" + model.Address + "</li>");
            }

            Contact.Text = sb.ToString();
           
        }
        private void BindReleatedLink()
        {
            LYQ.BLL.RelatedLink bll = new LYQ.BLL.RelatedLink();
            TRepeater.DataSource = bll.GetList("oid='" + vipid + "'");
            TRepeater.DataBind();
        }
        private void  BindProduct()
        {
            LYQ.BLL.Product bll = new LYQ.BLL.Product();
            DataSet ds = bll.GetList(model.ProductWhere);
            DataList1.DataSource = ds.Tables[0];
            DataList1.DataBind();
        }

    }
}
